﻿using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace MiniFox.Infrastructure
{
    /// <summary>
    /// 
    /// </summary>
    [JsonObject]
    public class PagedQueryObject<T> : QueryObject<T>, IPagedQueryObject
    {
        int _pageIndex = 1;
        int _pageSize = 10;

        /// <summary>
        /// 
        /// </summary>
        [JsonProperty("pageIndex")]
        public int PageIndex
        {
            get
            {
                return _pageIndex;
            }
            set
            {
                if (value <= 0)
                    value = 1;
                _pageIndex = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [JsonProperty("pageSize")]
        public int PageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {
                if (value <= 0)
                    value = 10;
                _pageSize = value;
            }
        }

    }
    /// <summary>
    /// 
    /// </summary>
    [JsonObject]
    public class PagedQueryObject : QueryObject
    {
        int _pageIndex = 1;
        int _pageSize = 10;

        /// <summary>
        /// 
        /// </summary>
        [JsonProperty("pageIndex")]
        public int PageIndex
        {
            get
            {
                return _pageIndex;
            }
            set
            {
                if (value <= 0)
                    value = 1;
                _pageIndex = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [JsonProperty("pageSize")]
        public int PageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {
                if (value <= 0)
                    value = 10;
                _pageSize = value;
            }
        }

    }
}
